package com.ivt.dao;

import java.util.List;

import javax.persistence.QueryHint;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.QueryHints;

import com.ivt.model.Courses;
import com.ivt.model.Teacher;
import com.ivt.utils.enums.AuditStatus;

public interface CoursesDao extends JpaRepository<Courses, Long> {

	@QueryHints({ @QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true") })
	@Query("SELECT c FROM  Courses c where c.status = ?1 and c.teacher = ?2 ")
	List<Courses> getCoursesByTeacher(AuditStatus status, Teacher teacher);

}
